#include "gtest/gtest.h"
#include "../BaseUtil/MyTest.h"
#include "PANEImp.h"
namespace PANEImp {

class PANEDocumentTest : public testing::Test {
protected:
    virtual void SetUp() {
    	doc = new PANEDocument();
    }
    virtual void TearDown() {
    	delete doc;
    }

    PANEDocument * doc;
};

TEST_F(PANEDocumentTest, Title) {
	doc->setTitle("AAA");
	ASSERT_STREQ( "AAA", doc->getTitle().c_str() );
}

TEST_F(PANEDocumentTest, CreateImageElement) {
	PANEImageElement * img = doc->createPANEImageElement();
	ASSERT_TRUE( img );
	ASSERT_STREQ( "IMAGE", img->getTagName().c_str() );
	ASSERT_STREQ( "IMAGE", doc->createPANEElement("IMAGE")->getTagName().c_str() );
	ASSERT_STREQ( "IMAGE", doc->createElement("IMAGE")->getTagName().c_str() );
}

TEST_F(PANEDocumentTest, CreateButtonElement) {
	PANEButtonElement * btn = doc->createPANEButtonElement();
	ASSERT_TRUE( btn );
	ASSERT_STREQ( "BUTTON", btn->getTagName().c_str() );
	ASSERT_STREQ( "BUTTON", doc->createPANEElement("BUTTON")->getTagName().c_str() );
	ASSERT_STREQ( "BUTTON", doc->createElement("BUTTON")->getTagName().c_str() );
}

TEST_F(PANEDocumentTest, CreateDivElement) {
	PANEDivElement * div = doc->createPANEDivElement();
	ASSERT_TRUE( div );
	ASSERT_STREQ( "DIV", div->getTagName().c_str() );
	ASSERT_STREQ( "DIV", doc->createPANEElement("DIV")->getTagName().c_str() );
	ASSERT_STREQ( "DIV", doc->createElement("DIV")->getTagName().c_str() );
}

TEST_F(PANEDocumentTest, CreateRadioElement) {
	PANERadioElement * radio = doc->createPANERadioElement();
	ASSERT_TRUE( radio );
	ASSERT_STREQ( "RADIO", radio->getTagName().c_str() );
	ASSERT_STREQ( "RADIO", doc->createPANEElement("RADIO")->getTagName().c_str() );
	ASSERT_STREQ( "RADIO", doc->createElement("RADIO")->getTagName().c_str() );
}

}
